/**
 * 作业表操作 
 */
var MenuData = {
    //查看所有作业
    queryALLData: function() {
        return "select a.*,b.name from task as a left join subject as b on a.subId = b.ID;"; 
    },
    //根据用户ID查看用户所有作业
    queryIDData: function(param) {
        return "select * from task where tuid = '"+param.uid+"' and subId = '"+param.sid+"';"; 
    },   
    //根据用户ID和学科ID查看用户所有作业
    querytidData: function(param) {
    return "select * from task where tuid = '"+param.uid+"' and subId = '"+param.sid+"';"; 
    },   
    //根据用户ID查看作业
    queryBYUIDData: function(param) {
        return "select a.*,b.name from task as a left join subject as b on a.subId = b.ID  where tuid = '"+param.uid+"';"; 
    },
     //根据ID查看作业
    queryBYIDData: function(param) {
        return "select * from task where ID = '"+param.id+"';"; 
    },
    //根据班级、学科获取学生作业
    queryTCData: function(param) {
        return "select a.*,b.USERNAME from task as a left join user as b on a.tuid = b.ID left join bu as c on a.tuid = c.uid where c.bid ='"+param.BID+"' and a.subid = '"+param.SID+"' ;"; 
    },
    // 删除ID对应的数据
    deleteData: function(param) {
        return "DELETE from task where ID = " + param.ID;
    },
    //打分数据
    updatetData: function(param) {
        return "UPDATE task SET achievement = '"+param.achieve+"'"+" WHERE ID = '"+param.ID+"'";
    },
    // 增加数据
    insertData: function(param) {
        return "INSERT INTO task set title = '"+param.title+"' , content = '"+ param.content+"' , imgpath = '"+ param.imgpath+"' , subId = '"+ param.subId+"' , tuid = '"+ param.tuid+"' , addtime = '"+ param.adt+"';";
    },
}
exports = module.exports = MenuData;